function [uu,vv]=update_u_v(N,K,ww,hGG,noise)
sum_hGGw=zeros(N,K);
for nn=1:N
    for kk=1:K
        temptemp = 0;
        for mm=1:N
            for ll=1:K
                temptemp = temptemp + abs(ww(:,mm,ll)'*hGG{mm,nn,kk})^2;
            end
        end
        sum_hGGw(nn,kk) = temptemp;
    end
end

% update u_{n,k}
uu=zeros(N,K);% real !!!!!!!!!
for nn=1:N
    for kk=1:K
        temptemp = abs(ww(:,nn,kk)'*hGG{nn,nn,kk})^2;
        uu(nn,kk) = temptemp / (noise + sum_hGGw(nn,kk) - temptemp);
    end
end

% update v_{n,k}
vv=zeros(N,K);% complex !!!!!!!!!
for nn=1:N
    for kk=1:K
        vv(nn,kk) = hGG{nn,nn,kk}'*ww(:,nn,kk) * sqrt((1+uu(nn,kk))) / ...
            (noise + sum_hGGw(nn,kk));
    end
end
end